<template>
  <el-drawer
    :title="$t('message.zxkxq')"
    size="60%"
    :visible.sync="isShowDrawer"
    @close="closeDrawer"
  >
    <div class="detail_header">
      <div class="sp_bew">
        <div class="left">
          <el-image v-if="detail.allPath" :src="detail.allPath" class="img" />
          <div class="title_wrap">
            <div>
              <span class="title">{{ detail.name }}</span>
              <span class="status">{{ detail.status === '1' ? $t('message.yqy'):$t('message.jy') }}</span>
            </div>
            <div class="placeholder9 mt10">{{ $t('message.zfsl2') }}：{{ detail.circulationAll || $t('message.bxl') }}</div>
          </div>
        </div>
        <div class="right">
          <div class="item">
            <div class="key">{{ $t('message.zfxsl') }}</div>
            <div class="value">{{ detail.circulationAll || $t('message.bxl') }}</div>
          </div>
          <div class="item">
            <div class="key">{{ $t('message.yxssl') }}</div>
            <div class="value">{{ detail.sellNum }}</div>
          </div>
          <div class="item">
            <div class="key">{{ $t('message.sysl2') }}</div>
            <div class="value">{{ detail.remainNum || $t('message.bxl') }}</div>
            <!-- <div v-else class="value">{{ detail.surplusDay || $t('message.bxl') }}</div> -->
          </div>
        </div>
      </div>
      <div class="createTime_wrap">
        <span class="item">{{ $t('message.createTime') }}：{{ detail.createTime }}</span>
        <span class="item">{{ $t('message.cjr') }}：{{ detail.creator }}</span>
        <span class="item">{{ $t('message.zhgxsj') }}：{{ detail.editTime }}</span>
        <span class="item">{{ $t('message.gxr') }}：{{ detail.editor }}</span>
      </div>
    </div>
    <div class="separate" />
    <div class="property-title">{{ $t('message.jbxx') }}</div>
    <div class="line">
      <div class="key">{{ $t('message.zxkmc') }}：</div>
      <div class="value">{{ detail.name }}</div>
    </div>
    <div class="line">
      <div class="key">{{ $t('message.xsj') }}：</div>
      <div class="value">{{ detail.price || 0 }}{{ $t('message.yuan') }}</div>
    </div>
    <div class="line">
      <div class="key">{{ $t('message.bjyxq') }}：</div>
      <div class="value">{{ detail.validTimeType == '1' ? $t('message.cqyx') : detail.validTime + $t('message.tnyx') }}</div>
    </div>
    <div class="line">
      <div class="key">{{ $t('message.sgzj') }}：</div>
      <div class="value">{{ detail.firstBuyIsGive == '0' ? $t('message.bzs') : detail.firstBuyGiveMoney + $t('message.tian') + ',' + $t('message.yxq') + detail.firstGiveMoneyValidTime + $t('message.tian') }}</div>
    </div>
    <div class="line">
      <div class="key">{{ $t('message.fgzj') }}：</div>
      <div class="value">{{ detail.repetitionBuyIsGive == '0' ? $t('message.bzs') : detail.repetitionBuyGiveMoney + $t('message.tian') + ',' + $t('message.yxq') + detail.repetitionGiveMoneyValidTime + $t('message.tian') }}</div>
    </div>
    <div class="line">
      <div class="key">{{ $t('message.zxkbj') }}：</div>
      <div class="value">{{ detail.cardPrice }}</div>
    </div>
    <div class="line">
      <div class="key">{{ $t('message.smsj') }}：</div>
      <div class="value">{{ detail.sellTimeType == '0' ? $t('message.cqsm') : detail.sellTimeStartString + ' ~ ' + detail.sellTimeEndString }}</div>
    </div>
    <div class="userInfo">
      <div class="key">{{ $t('message.sysm') }}：</div>
      <div class="value" v-html="detail.useInfo" />
    </div>

    <div class="property-title mt20">{{ $t('message.sygz') }}</div>
    <div class="line">
      <div class="key">{{ $t('message.zfxsl') }}：</div>
      <div class="value">{{ detail.circulationAll || $t('message.bxl') }}</div>
    </div>
    <div class="line">
      <div class="key">{{ $t('message.sfzczz') }}：</div>
      <div class="value">{{ detail.type == '1' ? $t('message.bzc2') : $t('message.zc2') }}</div>
    </div>
    <div class="line">
      <div class="key">{{ $t('message.sycg') }}：</div>
      <div class="value">{{ detail.useVenue }}</div>
    </div>
    <div class="df">
      <div class="key">{{ $t('message.xfqy') }}：</div>
      <el-table
        ref="table"
        :data="detail.discountItemInfo"
        border
        fit
        :header-row-class-name="'table-header'"
        class="doumee-element-table"
      >
        <el-table-column align="center" :label="$t('message.xfcy')" min-width="120">
          <template slot-scope="scope">
            <span>{{ scope.row.orderTypeName }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" :label="$t('message.zhekou')" min-width="80">
          <template slot-scope="scope">
            <span>{{ scope.row.discountInfo }}</span>
          </template>
        </el-table-column>
        <el-table-column align="center" :label="$t('message.syfw')" min-width="120">
          <template slot-scope="scope">
            <span>{{ scope.row.useInfo || $t('message.qb') }}</span>
          </template>
        </el-table-column>
      </el-table>
    </div>
  </el-drawer>
</template>

<script>
import {
  SpeailCardDetail
} from '@/api'
export default {
  name: 'ComboAdd',
  data() {
    return {
      isShowDrawer: false,
      detail: {},
      vipTypes: [],
      channels: {
        '1': this.$t('message.xcx'),
        '2': this.$t('message.cgd')
      }
    }
  },
  methods: {
    closeDrawer() {
      this.isShowDrawer = false
      this.$emit('close')
    },
    getDetail(id) {
      SpeailCardDetail({ param: { id }}).then(res => {
        this.detail = { ...res.record }
      })
    }
  }
}
</script>

<style lang="scss" scoped>
@import "@/styles/variables.scss";

.line{
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  font-size: 14px;
  // padding-left: 16px;
  .key{
    color: #666666;
  }
  .value{
    color: #222222;
    flex: 1;
  }
}
.userInfo{
  display: flex;
  .value{
    ::v-deep p{
      margin: 0;
    }
    flex: 1;
    overflow: auto;
  }
}
.discount_wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding-left: 34px;
  font-size: 14px;
  .key {
    width: 90px;
  }
  .discount {
    width: 33.33%;
    margin-bottom: 20px;
  }
}
.detail_header{
  font-size: 14px;
  .sp_bew{
    display: flex;
    justify-content: space-between;
    .left{
      display: flex;
      .img{
        width: 120px;
        margin-right: 20px;
      }
      .title{
        font-size: 18px;
        font-weight: 600;
        color: #222222;
      }
      .status{
        border-radius: 2px;
        border: 1px solid $primaryColor;
        color: $primaryColor;
        margin-left: 10px;
      }
    }
    .right{
      display: flex;
      background-color: #F4F7FC;
      border-radius: 2px;
      .item{
        padding: 14px 20px;
        .key{
          font-size: 12px;
          color: #666666;
        }
        .value{
          margin-top: 8px;
          color: #222222;
          font-weight: 600;
        }
      }
    }
  }
  .createTime_wrap{
    display: flex;
    margin: 16px 0;
    .item{
      margin-left: 30px;
      color: #999999;
      &:first-of-type {
        margin-left: 0;
      }
    }
  }
}
.separate{
  height: 1px;
  margin: 20px -20px;
  padding: 0 20px;
  background-color: #DFE2E8;
}
.tip {
  font-size: 14px;
  line-height: 1.5;
  color: #333;
}

.device-uploader {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #fff;
  cursor: pointer;
  border: 1px dashed #ccc;
  border-radius: 8px;
  transition: all 0.3s;
  margin-right: 20px;

  &:hover {
    border-color: $menuActive;

    .uploader-icon {
      color: $menuActive;
    }
  }

  ::v-deep .el-upload {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;

    .file {
      width: 100%;
      height: 100%;
      position: absolute;
      top: 0;
      left: 0;
      background-size: contain;
      background-position: center;
      background-repeat: no-repeat;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;

      .delete {
        background-color: rgba(0, 0, 0, 0.5);
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        display: none;
        align-items: center;
        justify-content: center;

        .icon {
          color: #fff;
        }
      }

      &:hover {
        .delete {
          display: flex;
        }
      }
    }
  }

  .uploader-icon {
    color: #aaaaaa;
    font-size: 22px;
    transition: all 0.3s;
  }
}
.count-style {
  display: inline-block;
  width: 45%;
  height: 60px;
}

.division-line {
  text-align: center;
  display: inline-block;
  color: #999;
  width: 50px;
}

.clock {
  display: inline-block;
}

.upload-style {
  vertical-align: middle;
  display: inline-block;
  // width: 60px;
  // height: 60px;
  border: none;
}

.img-style {
  margin: auto;
  background-color: #eee;
  width: 90px;
  height: 60px;
  vertical-align: middle;
}

.avatar {
  width: 60px;
  height: 60px;
  display: block;
}

.line-style {
  background-color: #dfe2e8;
  height: 1px;
  // width: 80%;
  // margin: 0 auto;
  margin-bottom: 20px;
}
</style>
